package main

import (
	"fmt"
	"net"
	"net/http"
	"time"
)

var url = []string{
	"http://www.baidu.com",
	"http://taobao.com",
	"http://google.com",
}

func main(){
	for _,v := range url{
		//自己定义一个客服端，设置请求超时时间
		c := http.Client{
			Transport:&http.Transport{
				Dial: func(network, addr string) (conn net.Conn, e error) {
					timeout := 2 * time.Second
					return net.DialTimeout(network, addr, timeout)
				},
			},
		}



		resp, err := c.Head(v)
		if err !=nil {
			fmt.Println("failed", err)
		}
		fmt.Printf("head succ ,status %v",resp.Status)
	}
}